﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.Entity;
using COM.OA.BLL;

public partial class qs_wenjian_wenjianhuifu : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) 
        {
            string id = this.Request.QueryString["f_id"];
            int fid = Int32.Parse(id);
            files fs = filesBLL.Select(fid);
            int jieshourenid=fs.f_takeu_id;
            users us=usersBLL.Select(jieshourenid);

            //取出接收人名
            this.lbJieShouRen.Text =us.u_username ;
            //文件名
            this.txtFname.Text = fs.f_filename;

        }
       
    }
    protected void btHuiFu_Click(object sender, EventArgs e)
    {
        //取当前文件ＩＤ
        string id = this.Request.QueryString["f_id"];
        int fid = Int32.Parse(id);
        files fs = filesBLL.Select(fid);
        //取接收人为回复人ID
        int hid=fs.f_takeu_id;
        //回复内容
        string hneirong = this.ftbNeiRong.Text;
        
        //回复时间
        DateTime htime = DateTime.Now;

        filerevert fe = new filerevert();
        fe.fre_f_id = fid;
        fe.fre_u_id = hid;
        fe.fre_content = hneirong;
        fe.fre_reverttime = htime;

        //如果回复成功更改是否回执
        filerevertBLL.Insert(fe);
        
            files fss = filesBLL.Select(fid);
            //将是否回执改为１
            //files fsss = new files();
            fss.f_isreturn =1;

          

            filesBLL.Update(fss);
            this.Response.Write(string.Format(GetRedirect.WINALERT, "回复成功"));
            this.Response.Write(string.Format(GetRedirect.REDIRECT, "fileslog.aspx"));


       



        
    }
}
